package com.java.escape.springproblem.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName DefaultManagerService
 * @Description TODO
 * @Author wyp
 * @Date 2023/9/12 11:15
 * @Version 1.0
 */
@Slf4j
@Service
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class DefaultManagerService {
    private List<String> names = null;

    @PostConstruct
    public void init() {
        log.info("Coming in DefaultManagerService initialized");
        this.names = new ArrayList<>(100);
    }

    public void addName(String name) {
        this.names.add(name);
    }

    public int countNames() {
        return this.names.size();
    }

    public List<String> getNames() {
        return this.names;
    }
}
